﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Hosting;
using DynamicHeader;
using Microsoft.Web.Infrastructure.DynamicModuleHelper;

[assembly: System.Web.PreApplicationStartMethod(typeof(PreApplicationStartCode), "Start")]

namespace DynamicHeader
{
    public class PreApplicationStartCode
    {
        private static readonly object _lock = new object();
        private static bool _registered;

        public static void Start()
        {
            lock (_lock)
            {
                if (_registered) return;

                DynamicModuleUtility.RegisterModule(typeof(DynamicHeaderModule));

                _registered = true;
            }
        }
    }
}
